<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
    let i=0;

    // 状态的概念
    let t = null;

    document.onmousemove = function(){
        if(t) return;
        t = setTimeout(()=>{
            console.log(++i);
            t = null;
        }, 300);
    }
    
</script>
</html>